import { PostApi, GetApiHad } from "../request/Index";
import type { ItitleAndcodequery,Iquery } from "../types/index";

export interface Idevicetype {
  id: String;
  title: String;
  twotitle:String;
  description: String;
}
export interface deviceSn {
  customerId: String;
  deviceTypeId: String;
  produceSun: Number;
  description: String;
}

export interface Iquerydevice extends Iquery {
  sn: String;
  deviceTypeName: String;
  customerName: String;
  imei: String;
}

export interface ICreateImei {
  imei: String;
  deviceId: String;
  description: String;
}

enum Api {
  querydevicetypeListApi = "/api/devicetype/list",
  querydeviceListApi = "/api/device/list",
  addorupdatedevicetypeApi = "/api/devicetype",
  createdeviceApi = "/api/device",
  createImeiApi ="/api/imei",
}
export async function querydevicetypeListApi(params: ItitleAndcodequery) {
  return GetApiHad(Api.querydevicetypeListApi, params);
}

//添加或者修改客户信息，Add or Update customer information
export async function addorupdatedevicetypeApi(
  type: String,
  params: Idevicetype
) {
  return PostApi(Api.addorupdatedevicetypeApi + `/${type}`, params);
}

export async function CreaeDeviceApi(params: deviceSn) {
  return PostApi(Api.createdeviceApi, params);
}

export async function QueryDeviceListApi(params: Iquerydevice) {
  return GetApiHad(Api.querydeviceListApi, params);
}

export async function CreateImeiApi(params:ICreateImei) {
    return PostApi(Api.createImeiApi, params);
}